package com.gf.pf.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gf.pf.mapper.ResourceMapper;
import com.gf.pf.model.Resource;
import com.gf.pf.model.Ztree;
import com.gf.pf.service.ResourceService;

/**
 * 
 * @description 资源菜单
 * @date   Mar 7, 2015
 */
@Service
@Transactional
public class ResourceServiceImpl implements ResourceService {
	
	@Autowired
	private ResourceMapper resourceMapper;
	
	/* (non-Javadoc)
	 * @see com.gf.pf.service.ResourceService#findResources(java.lang.String)
	 * 根据用户ID查询一级资源菜单
	 */
	public List<Resource> getYiJiResources(String userId) {
		return resourceMapper.getYiJiResources(userId);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.ResourceService#getErJiResources(java.lang.String)
	 * 根据资源ID查询二级资源菜单
	 */
	@Override
	public List<Resource> getErJiResources(Map<String, String> map) {
		return resourceMapper.getErJiResources(map);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.ResourceService#saveResource(com.gf.pf.model.Resource)
	 * 保存资源
	 */
	@Override
	public Integer saveResource(Resource resource) {
		return resourceMapper.saveResource(resource);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.ResourceService#getResource(java.lang.String)
	 * 根据资源ID查询资源信息
	 */
	@Override
	public Resource getResource(String resourceId) {
		return resourceMapper.getResource(resourceId);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.ResourceService#modifyResource(com.gf.pf.model.Resource)
	 * 修改资源
	 */
	@Override
	public Integer modifyResource(Resource resource) {
		return resourceMapper.modifyResource(resource);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.ResourceService#deleteResource(java.lang.String)
	 * 删除资源
	 */
	@Override
	public Integer deleteResource(String resourceId) {
		return resourceMapper.deleteResource(resourceId);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.ResourceService#getResouceZtree()
	 * 查询所有的资源
	 */
	@Override
	public List<Ztree> getResouceZtree() {
		return resourceMapper.getResourceZtree();
	}

}
